package flex.cc.vehicle_svr.controller;

import java.util.Map;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import flex.cc.core.support.BaseController;
import flex.cc.order.manage.service.OrderImgService;
import flex.cc.vehicle_svr.service.impl.UpPushService;
import flex.cc.wrapper.WrapMapper;
import flex.cc.wrapper.Wrapper;
import io.swagger.annotations.ApiOperation;

/**
*
* @author WANGCONG
* 2021年12月15日下午3:12:29
* @desc 图片回传、状态回写补推接口
*/
@RestController
@RequestMapping(value = "/vehicleSvr")
public class UpPushController extends BaseController {

	@Resource
	private OrderImgService orderImgService;
	@Resource
	private UpPushService pushService;
	
	/**
	 *
	 * @author WANGCONG
	 * 2021年12月15日下午3:14:06
	 * @desc 图片回传上游
	 */
	@PostMapping(value = "/pushSynImg")
    @ApiOperation(httpMethod = "POST", value = "手动同步到上游图片")
    public Wrapper<String> testSynImg( @RequestBody Map<String, String> reqVo) throws Exception{
    	logger.info("报文参数requestVo={}", reqVo);
    	String orderNos = reqVo.get("orderNo");
    	pushService.pushImg(orderNos);
    	return WrapMapper.ok();
    }

	/**
	 *
	 * @author WANGCONG
	 * 2022年1月5日下午3:22:18
	 * @desc 状态回传上游
	 */
	@PostMapping(value = "/pushSynStatus")
    @ApiOperation(httpMethod = "POST", value = "手动同步到上游状态")
    public Wrapper<String> testSynStatus( @RequestBody Map<String, String> reqVo) throws Exception{
    	logger.info("报文参数requestVo={}", reqVo);
    	String orderNos = reqVo.get("orderNo");
    	pushService.pushStatus(orderNos);
    	return WrapMapper.ok();
    }
}
